﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebUI.BL.Products;

namespace WebUI.AdminSite.Product
{
    public partial class ProductColorCreate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void BtnClickUpload(object sender, UserControls.EventUploadImg e)
        {
            txtImg.Text = e.FileName;
            imgColor.ImageUrl = Helpers.link.ToImages(e.FileName);
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            var httpCookie = Request.Cookies.Get("adler_userid");
            if (httpCookie != null)
            {
                var productColor = new WebUI.DAL.tbl_ProductColor
                                       {
                                           ColorCode = txtColorCode.Text,
                                           ColorDesc = txtDesc.Text,
                                           ColorName = txtColorName.Text,
                                           CreateUser = httpCookie.Value,
                                           CreatedDate = DateTime.Now,
                                           Img = txtImg.Text,
                                           Status = drpStatus.SelectedValue
                                       };
                var repository=new ProductColorBL();
                repository.Insert(productColor);
                Response.Redirect(Helpers.link.ToAdminProductColor("ProductColor.aspx"));
            }
        }
    }
}